package com.warehouse.service.impl;

import com.warehouse.dto.ReportWarin;
import com.warehouse.dto.Surplus;
import com.warehouse.mapper.ProductMapper;
import com.warehouse.mapper.StockMapper;
import com.warehouse.mapper.WarehouseMapper;
import com.warehouse.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//报表管理的业务接口实现层
@Service
public class ReportServiceImpl implements ReportService {
    //注入商品表层
    @Autowired
    private ProductMapper productMapper;
    //注入仓库层
    @Autowired(required = false)
    private WarehouseMapper warehouseMapper;
    //注入库存表
    @Autowired
    private StockMapper stockMapper;
    /**
     * 库存清单
     * @return
     */
    @Override
    public List<Surplus> findWare() {
        List<Surplus> list=warehouseMapper.findProSupr();
        return list;
    }

    /**
     * 可出库存
     * @return
     */
    @Override
    public List<Surplus> selectSurp() {
        List<Surplus> list=warehouseMapper.selectSurp();
        return list;
    }

    /**
     * 仓库容量
     * @return
     */
    @Override
    public List<Surplus> findWareArea() {
        List<Surplus> list=warehouseMapper.findWareArea();
        return null;
    }

    /**
     * 库存预警
     * @return
     */
    @Override
    public List<ReportWarin> findProNum() {
        List<ReportWarin> list=warehouseMapper.findProNum();
        return list;
    }

    /**
     * 库存预警的模糊搜索
     * @param proName
     * @return
     */
    @Override
    public List<ReportWarin> findLikePro(String proName) {
        String s="%"+proName+"%";
        System.out.println(s);
        List<ReportWarin> list=warehouseMapper.findLikePro(s);
        return list;
    }
}
